<?php
class Cookie
{
	// THE only instance of the class
	private static $instance;

	private function __construct() {}


	/**
	 *    Returns THE instance of 'Cookie'.
	 *    The session is automatically initialized if it wasn't.
	 *
	 *    @return    object
	 **/

	public function getInstance()
	{
		if ( !isset(self::$instance))
		{
			self::$instance = new self;
		}
	}

	public function set($name, $value, $expiry, $path = '/')
	{
		setcookie($name, $value, $expiry, $path);
	}

	public function get($name)
	{
		if ( isset($_COOKIE[$name]))
		{
			return $_COOKIE[$name];
		}
	}
}

